CC      := gcc
LD      := gcc
LDFLAGS := `pkg-config --libs gl glu sdl`
CCFLAGS := -Wall -Wstrict-prototypes `pkg-config --cflags gl glu sdl`
SRCLIST := $(wildcard *.c)
OBJLIST := $(patsubst %.c,%.o,$(SRCLIST))
BIN     := astroid-game
TARGET  := ../../bin/

all: $(BIN)

test:
	make new
	cp $(BIN) $(TARGET)$(BIN)
	cd $(TARGET)
	./$(BIN)

%.o: %.c
	$(CC) $(CCFLAGS) -c $<

$(BIN): $(OBJLIST)
	$(LD) -o $(BIN) $(LDFLAGS) $(OBJLIST)

.PHONY: clean test new
new:
	make clean
	make

clean:
	rm -f $(OBJLIST) $(BIN)
